/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package VOs;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Julian
 */
@Entity
@Table(name = "RESERVE")
@NamedQueries({@NamedQuery(name = "Reserve.findAll", query = "SELECT r FROM Reserve r"),
@NamedQuery(name = "Reserve.findById", query = "SELECT r FROM Reserve r WHERE r.id = :id"),
@NamedQuery(name = "Reserve.findByInitialdate", query = "SELECT r FROM Reserve r WHERE r.initialdate = :initialdate"),
@NamedQuery(name = "Reserve.findByFinaldate", query = "SELECT r FROM Reserve r WHERE r.finaldate = :finaldate"),
@NamedQuery(name = "Reserve.findByExternalid", query = "SELECT r FROM Reserve r WHERE r.externalid = :externalid"),
@NamedQuery(name = "Reserve.findByActivestate", query = "SELECT r FROM Reserve r WHERE r.activestate = :activestate")})
public class Reserve implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private BigDecimal id;
    @Basic(optional = false)
    @Column(name = "INITIALDATE")
    @Temporal(TemporalType.DATE)
    private Date initialdate;
    @Basic(optional = false)
    @Column(name = "FINALDATE")
    @Temporal(TemporalType.DATE)
    private Date finaldate;
    @Basic(optional = false)
    @Column(name = "EXTERNALID")
    private String externalid;
    @Column(name = "ACTIVESTATE")
    private BigInteger activestate;
    @JoinColumn(name = "FK_LOCATION", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Location fkLocation;
    @JoinColumn(name = "FK_PLAN", referencedColumnName = "ID_PLAN")
    @ManyToOne(optional = false)
    private Plan fkPlan;

    public Reserve() {
    }

    public Reserve(BigDecimal id) {
        this.id = id;
    }

    public Reserve(BigDecimal id, Date initialdate, Date finaldate, String externalid) {
        this.id = id;
        this.initialdate = initialdate;
        this.finaldate = finaldate;
        this.externalid = externalid;
    }

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    public Date getInitialdate() {
        return initialdate;
    }

    public void setInitialdate(Date initialdate) {
        this.initialdate = initialdate;
    }

    public Date getFinaldate() {
        return finaldate;
    }

    public void setFinaldate(Date finaldate) {
        this.finaldate = finaldate;
    }

    public String getExternalid() {
        return externalid;
    }

    public void setExternalid(String externalid) {
        this.externalid = externalid;
    }

    public BigInteger getActivestate() {
        return activestate;
    }

    public void setActivestate(BigInteger activestate) {
        this.activestate = activestate;
    }

    public Location getFkLocation() {
        return fkLocation;
    }

    public void setFkLocation(Location fkLocation) {
        this.fkLocation = fkLocation;
    }

    public Plan getFkPlan() {
        return fkPlan;
    }

    public void setFkPlan(Plan fkPlan) {
        this.fkPlan = fkPlan;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reserve)) {
            return false;
        }
        Reserve other = (Reserve) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "VOs.Reserve[id=" + id + "]";
    }

}
